package com.entity;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Book entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "book", catalog = "dangdang")
public class Book implements java.io.Serializable {
	private static final long serialVersionUID = 1L;
	private Integer id;
	private Product product;
	private String author;
	private String publishing;
	private String publishTime;
	private String wordNumber;
	private String edtion;
	private String totalPage;
	private String printTime;
	private String printNumber;
	private String isbn;
	private String authorSummary;
	private String catalogue;
	private Set<NewBook> newBooks = new HashSet<NewBook>(0);
	private Set<RecBook> recBooks = new HashSet<RecBook>(0);
	private Set<HotBook> hotBooks = new HashSet<HotBook>(0);

	// Constructors

	/** default constructor */
	public Book() {
	}

	/** full constructor */
	public Book(Product product, String author, String publishing,
			String publishTime, String wordNumber, String edtion,
			String totalPage, String printTime, String printNumber,
			String isbn, String authorSummary, String catalogue,
			Set<NewBook> newBooks, Set<RecBook> recBooks, Set<HotBook> hotBooks) {
		this.product = product;
		this.author = author;
		this.publishing = publishing;
		this.publishTime = publishTime;
		this.wordNumber = wordNumber;
		this.edtion = edtion;
		this.totalPage = totalPage;
		this.printTime = printTime;
		this.printNumber = printNumber;
		this.isbn = isbn;
		this.authorSummary = authorSummary;
		this.catalogue = catalogue;
		this.newBooks = newBooks;
		this.recBooks = recBooks;
		this.hotBooks = hotBooks;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "product_id")
	public Product getProduct() {
		return this.product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	@Column(name = "author", length = 200)
	public String getAuthor() {
		return this.author;
	}

	public void setAuthor(String author) {
		this.author = author;
	}

	@Column(name = "publishing", length = 200)
	public String getPublishing() {
		return this.publishing;
	}

	public void setPublishing(String publishing) {
		this.publishing = publishing;
	}

	@Column(name = "publish_time", length = 10)
	public String getPublishTime() {
		return this.publishTime;
	}

	public void setPublishTime(String publishTime) {
		this.publishTime = publishTime;
	}

	@Column(name = "word_number", length = 10)
	public String getWordNumber() {
		return this.wordNumber;
	}

	public void setWordNumber(String wordNumber) {
		this.wordNumber = wordNumber;
	}

	@Column(name = "edtion", length = 10)
	public String getEdtion() {
		return this.edtion;
	}

	public void setEdtion(String edtion) {
		this.edtion = edtion;
	}

	@Column(name = "total_page", length = 5)
	public String getTotalPage() {
		return this.totalPage;
	}

	public void setTotalPage(String totalPage) {
		this.totalPage = totalPage;
	}

	@Column(name = "print_time", length = 10)
	public String getPrintTime() {
		return this.printTime;
	}

	public void setPrintTime(String printTime) {
		this.printTime = printTime;
	}

	@Column(name = "print_number", length = 3)
	public String getPrintNumber() {
		return this.printNumber;
	}

	public void setPrintNumber(String printNumber) {
		this.printNumber = printNumber;
	}

	@Column(name = "isbn", length = 25)
	public String getIsbn() {
		return this.isbn;
	}

	public void setIsbn(String isbn) {
		this.isbn = isbn;
	}

	@Column(name = "author_summary", length = 65535)
	public String getAuthorSummary() {
		return this.authorSummary;
	}

	public void setAuthorSummary(String authorSummary) {
		this.authorSummary = authorSummary;
	}

	@Column(name = "catalogue", length = 65535)
	public String getCatalogue() {
		return this.catalogue;
	}

	public void setCatalogue(String catalogue) {
		this.catalogue = catalogue;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "book")
	public Set<NewBook> getNewBooks() {
		return this.newBooks;
	}

	public void setNewBooks(Set<NewBook> newBooks) {
		this.newBooks = newBooks;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "book")
	public Set<RecBook> getRecBooks() {
		return this.recBooks;
	}

	public void setRecBooks(Set<RecBook> recBooks) {
		this.recBooks = recBooks;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "book")
	public Set<HotBook> getHotBooks() {
		return this.hotBooks;
	}

	public void setHotBooks(Set<HotBook> hotBooks) {
		this.hotBooks = hotBooks;
	}

}